package com.rachel.activitytest.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.transition.Explode;
import android.transition.Fade;
import android.transition.Slide;
import android.view.Window;

import com.rachel.activitytest.EasyTransition;
import com.rachel.activitytest.R;

public class Main2Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);

        int flag = getIntent().getIntExtra("flag",0);
        switch (flag){
            case 0:
                getWindow().setEnterTransition(new Explode().setDuration(500));
                break;
            case 1:
                getWindow().setEnterTransition(new Slide().setDuration(500));
                break;
            case 2:
                getWindow().setEnterTransition(new Fade().setDuration(500));
                break;
            case 3:
             //   getWindow().setSharedElementEnterTransition(new ChangeBounds());

                break;
        }
        

        setContentView(R.layout.activity_main2);
        if (flag == 3){
            EasyTransition.enter(this);
        }
    }


    @Override
    public void onBackPressed() {
        super.onBackPressed();
        EasyTransition.exit(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EasyTransition.exit(this);
    }
}
